﻿//###HEADER###
//Title: RevitPlus
//Description of Program: Utilzing Revit geometry and properties, user is able to perform an EnergyPlus calculation within Revit.
//Class:RevitPlus
//Description of Class:   Creates ribbon and button for RevitPlus within Revit. 
//       
//By: Steve Chick & Alexander Bernstein
//Date: 12/18/2012
//Version: 001


using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media.Imaging;
using System.Xaml;
using System.Web.UI;
using System.Web;
using System.IO;
using System.Reflection;

using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;

using Microsoft.VisualBasic;

namespace Revit_Addin1
{
    //Define Class
    public class RevitPlus : IExternalApplication
    {
        //Begin Plugin on Start up
        public Result OnStartup(UIControlledApplication application)
        {
            //Create a custom ribbon panel
            String RevitPlus = "RevitPlus";
            RibbonPanel panel = application.CreateRibbonPanel(RevitPlus);

            // Create Project Information push button
            PushButtonData ProjInfo = new PushButtonData("RevitPlus Suite", "RevitPlus", @"C:\ProgramData\Autodesk\Revit\Addins\2013\RevitPlus.dll", "Revit_Addin1.UserInterface");

            // Add Images to button from resources
            Assembly a = this.GetType().Assembly;
            Stream s = a.GetManifestResourceStream("Revit_Addin1.RevitPlus_32x32.png");
            BitmapImage img = new BitmapImage();

            img.BeginInit();
            img.StreamSource = s;
            img.EndInit();

            //Apply image to push button
            ProjInfo.LargeImage = img;

            //Add descrpition to tool tip of button
            String Desc1 = "Revit to Energy Plus Interoperability Tool";
            ProjInfo.ToolTip = Desc1;

            panel.AddItem(ProjInfo);

            return Result.Succeeded;
        }

        //Close Plugin on Shutdown
        public Result OnShutdown(UIControlledApplication application)
        {
            return Result.Succeeded;
        }
    }
}